//路径名中的@表示src
import MainLayout from '@/views/Layout/MainLayout.vue';
import AuthLayout from '@/views/Pages/AuthLayout.vue';

import NotFound from '@/views/NotFoundPage.vue';

const routes = [
  {
    path: '/',
    // 访问path时会被重定向到redirect
    redirect: 'portfolioBacktesting',
    component: MainLayout,
    // 访问父path会显示父component，父component中的模板包括了子path们的router-link
    // 访问子path会显示子component
    children: [
      {
        path: '/icons',
        name: 'icons',
        component: () => import(/* webpackChunkName: "demo" */ '../views/Icons.vue')
      },
      {
        path: '/portfolioBacktesting',
        name: 'portfolioBacktesting',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/PortfolioBacktesting.vue')
      },
      {
        path: '/recordTables',
        name: 'recordTables',
        component: () => import(/* webpackChunkName: "demo" */ '../views/RecordTables.vue')
      },
      {
        path: '/simTrade',
        name: 'simTrade',
        component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/SimTrade.vue')
      }

    ]
  },
  {
    path: '/',
    redirect: 'login',
    component: AuthLayout,
    children: [
      // {
      //   path: '/login',
      //   name: 'login',
      //   component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Login.vue')
      // },
      // {
      //   path: '/register',
      //   name: 'register',
      //   component: () => import(/* webpackChunkName: "demo" */ '../views/Pages/Register.vue')
      // },
      { path: '*', component: NotFound }
    ]
  }
];

export default routes;
